require(['config', 'animation', 'fullpage'], function (config) {

  // fullpage初始化
  $('#fullpage').fullpage({
    anchors: ['page1', 'page2', 'page3', 'page4', 'page5','page6', 'footer'],
    scrollingSpeed: 500,
    navigation: true,
    onLeave: function (index, nextIndex ) {
      if (nextIndex === 1) {
        videoPlay();
        $('#J-nav').addClass('none')
      }
      if (nextIndex !== 1) {
        $('#J-nav').removeClass('none')
      }
      var aniName = $('.section').eq(index).data('aniname');
      $('.' + aniName).animation();
    },
    // 初始化完成callback
    afterRender: function () {
      videoPlay()
    }
  })

  function videoPlay () {
    $('video')[0].play();
  }
  
  $('.mouse').click(function () {
    $.fn.fullpage.moveSectionDown();
  })
  
})
